import request from '@/config/axios'

// 工单信息 VO
export interface WorkOrderVO {
  id?: number // 工单ID
  orderId: number // 订单ID
  technicianId: number // 技术员ID
  status: number // 工单状态
  createTime?: number // 创建时间
}

// 工单信息 API
export const WorkOrderApi = {
  // 查询工单信息分页
  getWorkOrderPage: async (params: any) => {
    return await request.get({ url: `/workOrder/page`, params })
  },

  // 查询工单信息详情
  getWorkOrder: async (id: number) => {
    return await request.get({ url: `/workOrder/get?id=` + id })
  },

  // 新增工单信息
  createWorkOrder: async (data: WorkOrderVO) => {
    return await request.post({ url: `/workOrder/create`, data })
  },

  // 修改工单信息
  updateWorkOrder: async (data: WorkOrderVO) => {
    return await request.put({ url: `/workOrder/update`, data })
  },

  // 删除工单信息
  deleteWorkOrder: async (id: number) => {
    return await request.delete({ url: `/workOrder/delete?id=` + id })
  },

  // 导出工单信息 Excel
  exportWorkOrder: async (params) => {
    return await request.download({ url: `/workOrder/export-excel`, params })
  },
}
